﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ClientEdit.aspx.cs" Inherits="Web.DocumentsManage.ClientEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>客户编辑</title>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
    <link href="../extjs/resources/css/ext-all.css" rel="stylesheet" type="text/css" />
    <link href="../css/style.css" rel="stylesheet" rev="stylesheet" type="text/css" />
    <link href="../css/style_of_1024.css" rel="stylesheet" rev="stylesheet" type="text/css" />
    <%
        string contextPath = "/" == HttpContext.Current.Request.ApplicationPath ? "/" : HttpContext.Current.Request.ApplicationPath + "/";
    %>

    <script type="text/javascript">
　        var strPath = "<%=contextPath %>";
    </script>

    <script type="text/javascript" src="<%=contextPath %>extjs/adapter/ext/ext-base.js"></script>

    <script type="text/javascript" src="<%=contextPath %>extjs/ext-all.js"></script>

    <script type="text/javascript" src="<%=contextPath %>extjs/ext-lang-zh_CN.js"></script>

    <script type="text/javascript" src="<%=contextPath %>scripts/foothill-core.js"></script>

    <script type="text/javascript" src="<%=contextPath %>scripts/validator.js"></script>

    <script type="text/javascript" src="<%=contextPath %>scripts/datepicker/WdatePicker.js"></script>

    <script type="text/javascript" src="<%=contextPath %>scripts/Public.js"></script>

    <script type="text/javascript" src="<%=contextPath %>QuickUpload/CJL.0.1.min.js"></script>

    <script type="text/javascript" src="<%=contextPath %>QuickUpload/Upload.js"></script>

    <script type="text/javascript" src="<%=contextPath %>scripts/DocumentsManage/ClientEdit.js"></script>

</head>
<body>
    <form id="form1" runat="server">
    <table style="margin: 0px; width: 100%; background: #fff;" cellpadding="0" cellspacing="0">
        <tr>
            <td colspan="4" style="background-image: url('../images/white-top-bottom.gif'); height: 24px;
                font-size: 13px; font-weight: bold; padding-left: 5px; border-bottom: 1px solid #8AC0D9;">
                客户编辑
            </td>
        </tr>
        <tr style="height: 30px;">
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                width: 80px; background: #ECF6FB;">
                编号：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_client_code" style="width: 93%;" onchange="UpdateClientInfo('client_code',this.value);" />
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                width: 80px; background: #ECF6FB;">
                客户名：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_client_name" style="width: 93%;" onchange="UpdateClientInfo('client_name',this.value);" />
            </td>
        </tr>
        <tr style="height: 30px;">
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                background: #ECF6FB;">
                联系人：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_lianxiren" style="width: 93%;" onchange="UpdateClientInfo('lianxiren',this.value);" />
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                background: #ECF6FB;">
                电话：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_telephone" style="width: 93%;" onchange="UpdateClientInfo('telephone',this.value);" />
            </td>
        </tr>
        <tr style="height: 30px;">
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                background: #ECF6FB;">
                地址：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_address" style="width: 93%;" onchange="UpdateClientInfo('address',this.value);" />
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                background: #ECF6FB;">
                帽款：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_maokuan" style="width: 93%;" onchange="UpdateClientInfo('maokuan',this.value);" />
            </td>
        </tr>
        <tr style="height: 30px;">
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                background: #ECF6FB;">
                唛头：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_maitou" style="width: 93%;" onchange="UpdateClientInfo('maitou',this.value);" />
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                background: #ECF6FB;">
                吊牌：
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; padding-left: 5px;">
                <input type="text" id="ipt_diaopai" style="width: 93%;" onchange="UpdateClientInfo('diaopai',this.value);" />
            </td>
        </tr>
        <tr style="height: 30px;">
            <td style="border-bottom: 1px solid #8AC0D9; border-right: 1px solid #8AC0D9; text-align: right;
                text-align: center; background: #ECF6FB;">
                唛头图片
            </td>
            <td id="td_maitou_image" style="border-right: 1px solid #8AC0D9; padding-left: 5px;"
                onclick="showWinClientImg('img_maitou_image','hid_maitou_image');">
                <img src="" id="img_maitou_image" alt="点击上传或更新图片" />
                <input type="hidden" id="hid_maitou_image" />
            </td>
            <td style="border-bottom: 1px solid #8AC0D9; text-align: right; background: #ECF6FB;">
                吊牌图片
            </td>
            <td id="td_diaopai_image" style="border-left: 1px solid #8AC0D9; padding-left: 5px;"
                onclick="showWinClientImg('img_diaopai_image','hid_diaopai_image');">
                <img src="" id="img_diaopai_image" alt="点击上传或更新图片" />
                <input type="hidden" id="hid_diaopai_image" />
            </td>
        </tr>
    </table>
    <%--保存按钮--%>
    <div style="position: fixed; right: 2px; top: 1px;">
        <input type="button" value="完成" id="btnSaveClient" style="padding: 0px 13px; height: 22px;"
            onclick="javascript:window.location.href('ClientList.aspx');" />
    </div>
    </form>
    <div id="divClientImg" style="display: none;">
        <form id="form2" action="../QuickUpload/Files.ashx" method="post" enctype="multipart/form-data">
        <table width="100%" cellpadding="0" cellspacing="0" style="text-align: center;">
            <tr>
                <td colspan="4">
                    <img id="imgClient" src="" runat="server" />
                    <div>
                        (图片尺寸按页面宽度缩放)</div>
                </td>
            </tr>
            <tbody id="idTable">
                <tr>
                    <td style="text-align: center; padding-top: 10px; padding-left: 1px;">
                        <input id="fileQuick" name="file" type="file" style="height: 20px; width: 300px;" />
                        <input id="idQuick" type="button" value="上传" style="height: 20px; width: 80px;" />
                    </td>
                </tr>
            </tbody>
            <tr>
                <td style="padding-top: 5px;">
                    <span id="span_info">请选择图片文件（*.jpg,*.gif,*.png,*.bmp)</span>
                </td>
            </tr>
        </table>
        </form>

        <script type="text/javascript">
            var qus = [], count = 0, table = $$("idTable"), model = table.removeChild(table.rows[0]);

            function addUploadRS() {
                var row = model.cloneNode(true),
                inputs = row.getElementsByTagName("input"),
                file = inputs[0]
                msg = document.getElementById("span_info");
                qu = new QuickUpload(file, {
                    action: "../QuickUpload/Files.ashx",
                    timeout: 30,
                    onReady: function() {
                        count++;
                        show("文件上传中，请稍候..");
                        //设置表单
                        this.parameter.title = "Img_" + Math.random();
                    },
                    onFinish: function(iframe) {
                        try {//处理返回信息(需要后台配合)
                            var info = eval("(" + iframe.contentWindow.document.body.innerHTML + ")");
                            show("<font color='green'>图片上传成功</font>");
                        } catch (e) {//获取数据出错
                            show("<font color='red'>上传失败</font>"); stop(); return;
                        }
                        count--; CheckBtn();
                        document.getElementById(imgClientImgID).src = "../UploadFile/" + info.ImgName;
                        document.getElementById("imgClient").src = "../UploadFile/" + info.ImgName;
                        document.getElementById(hidClientImgID).value = info.ImgName;
                    },
                    onStop: function() { show("<font color='red'>已经停止</font>"); stop(); },
                    onTimeout: function() { show("<font color='red'>上传超时</font>"); stop(); }
                });

                function stop() {
                    count--; CheckBtn();
                    file.style.display = "";
                }

                function show(m) { msg.innerHTML = m; }

                file.onchange = function() { show(this.value ? "<font color='blue'>准备上传</font>" : "选择文件"); }
                qus.push(qu);
                table.appendChild(row);
            }

            addUploadRS();

            $$("idQuick").onclick = function() {
                $$A.filter(qus, function(qu) { qu.upload(); });
            }

            function CheckBtn() {
                $$("idQuick").disabled = !!count;
            }

            function ResetFile(file) {
                file.value = ""; //ff chrome safari
                if (file.value) {
                    if ($$B.ie) {//ie
                        with (file.parentNode.insertBefore(document.createElement('form'), file)) {
                            appendChild(file); reset(); removeNode(false);
                        }
                    } else {//opera
                        file.type = "text"; file.type = "file";
                    }
                }
            }
        </script>

    </div>
</body>
</html>
